package cate.game.role.x;

import cate.common.game.role.RoleAbstract;
import cate.game.role.Role;

public class RoleAbstractWriter {

    public static RoleAbstract create(Role role) {
        RoleAbstract a = new RoleAbstract();
        a.id = role.getUid();
        a.srvId = role.getBase().srvId;
        a.sex = role.getBase().sex;
        a.name = role.getBase().name;
        a.level = role.getBase().level;
        a.power = role.getBase().power;
        try {
            a.headIconTid = role.getBase().headIcon.tid;
        } catch (Exception e) {
            a.err = "headIcon是null";
        }
        try {
            a.headFrameTid = role.getBase().headFrame.tid;
            a.headFrameLevel = role.getBase().headFrame.level;
        } catch (Exception e) {
            a.err = "headFrame是null";
        }
        try {
            a.avatarTid = role.getBase().avatar.tid;
        } catch (Exception e) {
            a.err = "avatar是null";
        }
        try {
            a.titleTid = role.getBase().title.tid;
        } catch (Exception e) {
            a.err = "title是null";
        }
        return a;
    }
}
